package ccnu.agile.strategy.requestlog.impl;

import ccnu.agile.bean.request.Request;
import ccnu.agile.constant.System;
import ccnu.agile.strategy.requestlog.IRequestLogStrategy;
import ccnu.agile.utils.JSONUtils;
import org.aspectj.lang.JoinPoint;
import org.springframework.stereotype.Service;

/**
 * @Description: Post类型请求参数日志打印策略类
 * @Author: JreamY
 * @Date: 2021/10/21
 **/
@Service(System.RequstLogStrategy.POST)
public class PostRequestLogStrategy implements IRequestLogStrategy {

    @Override
    public void requestLog(JoinPoint joinPoint) {

        Object[] arguments = joinPoint.getArgs();
        Request request = (Request) arguments[0];
        log("POST: " + JSONUtils.toJSON(request));
    }
}
